






package pers.liyan.shi.springboot.config;

import org.mybatis.spring.annotation.MapperScan;
import org.mybatis.spring.boot.autoconfigure.ConfigurationCustomizer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


//在配置类上使用此注解指定扫描Mapper接口的包
@MapperScan(basePackages = {"pers.liyan.shi.springboot.mapper"})
@Configuration
public class MyBatisConfig {

    //自定义mybatis配置规则
    @Bean
    public ConfigurationCustomizer configurationCustomizer(){
        //return configuration -> {
        //  configuration.setMapUnderscoreToCamelCase(true);
        //};

        return new ConfigurationCustomizer() {
            @Override
            public void customize(org.apache.ibatis.session.Configuration configuration) {
                //开启驼峰命名法映射规则
                configuration.setMapUnderscoreToCamelCase(true);
            }
        };
    }

}